﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Diagnostics;

namespace WcfCore
{
	[Serializable]
	public class WcfTestOutput
	{
		public WcfTestOutput()
		{
		}

		public WcfTestOutput(long callCount, long tickCount, long methodTickCount, long transactionTickCount, long sessionTickCount)
		{
			CallCount = callCount;
			MethodTickCount = methodTickCount;
			TransactionTickCount = transactionTickCount;
			SessionTickCount = sessionTickCount;
		}

		public long CallCount;
		public long MethodTickCount;
		public long TransactionTickCount;
		public long SessionTickCount;

		public static double TicksPerMicroSec = Stopwatch.Frequency / 1000000;

		public double AvgMethodMicroSecs
		{
			get
			{
				return ((double)MethodTickCount / TicksPerMicroSec) / CallCount;
			}
		}

		public double AvgTransactionMicroSecs
		{
			get
			{
				return ((double)TransactionTickCount / TicksPerMicroSec) / CallCount;
			}
		}

		public double AvgSessionMicroSecs
		{
			get
			{
				return ((double)SessionTickCount / TicksPerMicroSec) / CallCount;
			}
		}
	}
}
